package view.dragon.com.draggridview;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.baidu.mobstat.StatService;

public class MainActivity extends AppCompatActivity implements View.OnLongClickListener {
    DragViewGroup dragViewGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        dragViewGroup = (DragViewGroup) findViewById(R.id.dragLayout);
        int count = dragViewGroup.getChildCount();

        for(int i = 0; i<count; i++){
            View view = dragViewGroup.getChildAt(i);
            view.setOnLongClickListener(this);
        }
    }


    @Override
    public boolean onLongClick(View v) {
        dragViewGroup.interruptTouch(v);
        return true;
    }

    @Override
    protected void onResume() {
        StatService.onResume(this);
        super.onResume();
    }
}
